<template>
  <div>
    <crumb />
    <div class="main-contianer3 course-setting">
      <div class="top-content">
        <SelectCourseClass class="top-select" />
        <div class="top-tabs flex-row">
          <ul class="tabs flex-row">
            <li :class="['tab', { 'active': tabId == 1 }]" @click="changeTab(1)">全局</li>
            <li :class="['tab', { 'active': tabId == 2 }]" @click="changeTab(2)">计划</li>
            <li :class="['tab', { 'active': tabId == 3 }]" @click="changeTab(3)">课程</li>
            <li :class="['tab', { 'active': tabId == 4 }]" @click="changeTab(4)">实践</li>
            <!-- <li :class="['tab', { 'active': tabId == 5 }]" @click="changeTab(5)">评论</li> -->
          </ul>
          <!-- <el-button type="primary" size="small">应用</el-button> -->
        </div>
      </div>
      <Global :school-id="schoolId" v-if="tabId === 1" />
      <Plan :school-id="schoolId" v-else-if="tabId === 2" />
      <Course :school-id="schoolId" v-else-if="tabId === 3" />
      <Training :school-id="schoolId" v-else-if="tabId === 4" />
      <Score :school-id="schoolId" v-else-if="tabId === 5" />
     </div>
  </div>
</template>

<script>
import SelectCourseClass from '@/components/SelectCourseClass'
import Global from './Global'
import Plan from './Plan'
import Score from './Score'
import Course from './Course'
import Training from './Training'
import { mapGetters } from 'vuex'

import {
  getSchoolId
} from '@/api/biz-data'
export default {
  name: 'index',
  data () {
    return {
      tabId: 1,
      schoolId: null
    }
  },
  computed: {
    ...mapGetters([
      'loginInfo'
    ])
  },
  components: {
    SelectCourseClass,
    Global,
    Plan,
    Score,
    Course,
    Training
  },
  mounted () {
    this.getSchoolId()
  },
  methods: {
    changeTab (tab) {
      this.tabId = tab
    },
    async getSchoolId () {
      const res = await getSchoolId({ uid: this.loginInfo.userId })
      if (res.code === '200') {
        this.schoolId = res.data
      } else {
        this.$message.error(res.message)
      }
    }
  }
}
</script>
<style scoped lang="scss">
.course-setting {
  .top-content {
    width: 100%;
    background: #fff;
    .top-select {
      padding: 20px;
    }
    .top-tabs {
      height: 50px;
      width: 100%;
      padding: 20px 20px 20px 0;
      .tabs {
        width: 100%;
        height: 60px;
        justify-content: flex-start;
        .tab {
          width: 133px;
          text-align: center;
          font-size: 20px;
          height: 50px;
          line-height: 50px;
          color: #101d37;
          cursor: pointer;
          &.active {
            color: #fff;
            background: #009CF6;
          }
        }
      }
    }
  }
}
</style>
